<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Dom对象</title>
</head>
<body>
    <span class="one">
        英语
    </span>
    <span class="two">
        数学
    </span>
    <span class="one">
        语文
    </span>
    <span class="two">
        物理
    </span>
    <script>
        //document.getElementsByClassName()是通过类名获取
        //html5中新增的获取方式
        var Ospan1 = document.getElementsByClassName('one');
        var Ospan2 = document.getElementsByClassName('two');
        Ospan1[0].style.fontWeight = 'bold';
        Ospan2[1].style.background = 'red';
    </script>
</body>
</html>